<template>
  <!-- 添加或修改项目基础信息管理对话框 -->
  <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" append-to-body v-dialogDrag width="90%">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
             label-width="98px">
      <el-form-item label="关联销售订单单行金具编码" prop="goodsCode">
        <el-input v-model="queryParams.goodsCode" placeholder="请输入关联销售订单单行金具编码"
                  clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="关联销售订单单行金具名称" prop="goodsName">
        <el-input v-model="queryParams.goodsName" placeholder="请输入关联销售订单单行金具名称"
                  clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="关联销售订单单行金具型号" prop="goodsModel">
        <el-input v-model="queryParams.goodsModel" placeholder="请输入关联销售订单单行金具型号"
                  clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="columns" ref="dragTable" row-key="id" v-loading="loading">
        <el-table-column align="center" label="序号" type="index" width="50">
          <template slot-scope="scope">
            <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
          </template>
        </el-table-column>
        <el-table-column label="销售订单号" align="center" prop="projectCode" show-overflow-tooltip/>
        <!--<el-table-column label="销售订单名称" align="center" prop="order.projectName" show-overflow-tooltip/>-->
        <el-table-column label="合同产品名称" align="center" prop="name" show-overflow-tooltip/>
        <el-table-column label="合同产品型号" align="center" prop="models"/>
        <el-table-column align="center" label="工程名称" prop="gongchengName" show-overflow-tooltip/>
        <el-table-column align="center" label="关联销售订单单行金具编码" prop="goodsCode"/>
        <el-table-column align="center" label="关联销售订单单行金具名称" prop="goodsName"/>
        <el-table-column align="center" label="关联销售订单单行金具型号" prop="goodsModel"/>
        <el-table-column align="center" label="串里面的数量" prop="count"/>
        <el-table-column align="center" label="合同数量" prop="weight"/>
        <el-table-column align="center" label="总数量" prop="goodsCount"/>
        <el-table-column align="center" label="备注" prop="remark"/>
    </el-table>

    <div class="dialog-footer" slot="footer">
      <el-button @click="cancel">取 消</el-button>
    </div>
  </el-dialog>
</template>

<script>
  import {deleteAction, downloadFile, getAction} from '@/api/manage'

export default {
  name: "ContractualCjList",
  dicts: ['isdo','sale_state','goods_status'],
  data() {
    return {
      // 遮罩层
      loading: true,
      activeName: "first",
      // 弹出层标题
      title: "串拆解明细",
      // 是否显示弹出层
      open: false,
      // 显示搜索条件
      showSearch: true,
      // 表单参数
      form: {},
      proId: "",
      proStatus: "",
      columns: [],
      total: 0,
      // 表单校验
      rules: {
      },
      queryParams: {
        pageNum: 1,
        pageSize: 1000,
        id: null,
        code: null,
        projectNo: null,
        goodsName: null,
        goodsCode: null,
        goodsModel: null,
        goodsSaleId: null,
        //orderByColumn:"isdo",
        isAsc:"desc"
      },
      url: {
        list: '/goodsSaleChuan/goodsSaleChuan/selectByGoodsSaleId',
        getById: '/projectBaseInfo/projectBaseInfo/',
      },
    };
  },
  created() {
    // this.handleQuery();
  },
  methods: {
    caijieOpen(row){
      this.open = true;
      this.queryParams.goodsSaleId = row.id;
      this.getList();
    },
    getList(row) {
      this.loading = true;
      getAction(this.url.list, this.queryParams).then(response => {
        this.columns = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    reset() {
      this.form = {
        id: null,
        goodsName: null,
        goodsCode: null,
        goodsModel: null,
      };
      this.resetForm("form");
    },
    /*handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      this.proId = id;
      this.proStatus = row.status;
      getById(this.url.getById, id).then(response => {
        this.open = true;
        this.title = "修改订单基础信息管理";
        this.getList();
      });
    },*/
  }
};
</script>
